.class public Lcom/glympse/platform/LocManager$ProviderSimulator;
.super Lcom/glympse/platform/common/GTimer;
.source "LocManager.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/glympse/platform/LocManager;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x4
    name = "ProviderSimulator"
.end annotation


# instance fields
.field private m_nCount:I

.field private m_oLocPointLast:Lcom/glympse/platform/common/LocPoint;

.field private m_oRandom:Ljava/util/Random;

.field final synthetic this$0:Lcom/glympse/platform/LocManager;


# direct methods
.method public constructor <init>(Lcom/glympse/platform/LocManager;)V
    .locals 2
    .parameter

    .prologue
    .line 613
    iput-object p1, p0, Lcom/glympse/platform/LocManager$ProviderSimulator;->this$0:Lcom/glympse/platform/LocManager;

    .line 612
    const-wide/16 v0, 0x3e8

    invoke-direct {p0, v0, v1}, Lcom/glympse/platform/common/GTimer;-><init>(J)V

    .line 605
    new-instance v0, Ljava/util/Random;

    invoke-direct {v0}, Ljava/util/Random;-><init>()V

    iput-object v0, p0, Lcom/glympse/platform/LocManager$ProviderSimulator;->m_oRandom:Ljava/util/Random;

    .line 606
    const/4 v0, 0x0

    iput v0, p0, Lcom/glympse/platform/LocManager$ProviderSimulator;->m_nCount:I

    .line 607
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/glympse/platform/LocManager$ProviderSimulator;->m_oLocPointLast:Lcom/glympse/platform/common/LocPoint;

    return-void
.end method


# virtual methods
.method public OnTimer()V
    .locals 40

    .prologue
    .line 640
    move-object/from16 v0, p0

    iget v0, v0, Lcom/glympse/platform/LocManager$ProviderSimulator;->m_nCount:I

    move/from16 v32, v0

    add-int/lit8 v32, v32, 0x1

    move/from16 v0, v32

    move-object/from16 v1, p0

    iput v0, v1, Lcom/glympse/platform/LocManager$ProviderSimulator;->m_nCount:I

    const/16 v33, 0x5

    move/from16 v0, v32

    move/from16 v1, v33

    if-ge v0, v1, :cond_0

    .line 704
    :goto_0
    return-void

    .line 645
    :cond_0
    invoke-static {}, Lcom/glympse/platform/common/CorrectedTime;->GetTime()J

    move-result-wide v29

    .line 648
    .local v29, lCurrentTime:J
    const-wide v27, 0x4044822d0e560419L

    .line 649
    .local v27, dTop:D
    const-wide v13, 0x40447dd2f1a9fbe7L

    .line 652
    .local v13, dBottom:D
    const-wide v21, -0x3fa0fb6d1e108c3fL

    .line 655
    .local v21, dLeft:D
    add-double v32, v27, v13

    const-wide/high16 v34, 0x4000

    div-double v32, v32, v34

    sub-double v34, v27, v13

    const-wide/high16 v36, 0x4000

    div-double v34, v34, v36

    move-wide/from16 v0, v29

    long-to-double v0, v0

    move-wide/from16 v36, v0

    const-wide v38, 0x408f400000000000L

    div-double v36, v36, v38

    const-wide v38, 0x3f91df46a2529d39L

    mul-double v36, v36, v38

    invoke-static/range {v36 .. v37}, Ljava/lang/Math;->sin(D)D

    move-result-wide v36

    mul-double v34, v34, v36

    add-double v19, v32, v34

    .line 656
    .local v19, dLatitudeDegrees:D
    const-wide/16 v32, 0xa

    div-long v32, v29, v32

    const-wide/32 v34, 0x2f75f63

    rem-long v32, v32, v34

    move-wide/from16 v0, v32

    long-to-double v0, v0

    move-wide/from16 v32, v0

    const-wide v34, 0x412e848000000000L

    div-double v32, v32, v34

    add-double v23, v21, v32

    .line 658
    .local v23, dLongitudeDegrees:D
    const-wide/16 v25, 0x0

    .local v25, dSpeedMetersPerSecond:D
    const-wide/16 v17, 0x0

    .line 661
    .local v17, dHeadingDegrees:D
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/glympse/platform/LocManager$ProviderSimulator;->m_oLocPointLast:Lcom/glympse/platform/common/LocPoint;

    move-object/from16 v32, v0

    if-eqz v32, :cond_1

    .line 664
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/glympse/platform/LocManager$ProviderSimulator;->m_oLocPointLast:Lcom/glympse/platform/common/LocPoint;

    move-object/from16 v32, v0

    move-object/from16 v0, v32

    iget-wide v0, v0, Lcom/glympse/platform/common/LocPoint;->m_dLatitude:D

    move-wide/from16 v32, v0

    const-wide v34, 0x3f91df46a2529d39L

    mul-double v3, v32, v34

    .line 665
    .local v3, dLatRadsPrev:D
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/glympse/platform/LocManager$ProviderSimulator;->m_oLocPointLast:Lcom/glympse/platform/common/LocPoint;

    move-object/from16 v32, v0

    move-object/from16 v0, v32

    iget-wide v0, v0, Lcom/glympse/platform/common/LocPoint;->m_dLongitude:D

    move-wide/from16 v32, v0

    const-wide v34, 0x3f91df46a2529d39L

    mul-double v5, v32, v34

    .line 668
    .local v5, dLngRadsPrev:D
    const-wide v32, 0x3f91df46a2529d39L

    mul-double v7, v19, v32

    .line 669
    .local v7, dLatRadsCur:D
    const-wide v32, 0x3f91df46a2529d39L

    mul-double v9, v23, v32

    .line 672
    .local v9, dLngRadsCur:D
    invoke-static/range {v3 .. v10}, Lcom/glympse/platform/common/Helpers;->ComputeDistance(DDDD)D

    move-result-wide v15

    .line 675
    .local v15, dDistRads:D
    const-wide v32, 0x415854a640000000L

    mul-double v32, v32, v15

    const-wide v34, 0x408f400000000000L

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/glympse/platform/LocManager$ProviderSimulator;->m_oLocPointLast:Lcom/glympse/platform/common/LocPoint;

    move-object/from16 v36, v0

    move-object/from16 v0, v36

    iget-wide v0, v0, Lcom/glympse/platform/common/LocPoint;->m_lLocationTime:J

    move-wide/from16 v36, v0

    sub-long v36, v29, v36

    move-wide/from16 v0, v36

    long-to-double v0, v0

    move-wide/from16 v36, v0

    div-double v34, v34, v36

    mul-double v25, v32, v34

    .line 679
    sub-double v32, v9, v5

    invoke-static/range {v32 .. v33}, Ljava/lang/Math;->sin(D)D

    move-result-wide v32

    invoke-static {v7, v8}, Ljava/lang/Math;->cos(D)D

    move-result-wide v34

    mul-double v32, v32, v34

    .line 680
    invoke-static {v3, v4}, Ljava/lang/Math;->cos(D)D

    move-result-wide v34

    invoke-static {v7, v8}, Ljava/lang/Math;->sin(D)D

    move-result-wide v36

    mul-double v34, v34, v36

    invoke-static {v3, v4}, Ljava/lang/Math;->sin(D)D

    move-result-wide v36

    invoke-static {v7, v8}, Ljava/lang/Math;->cos(D)D

    move-result-wide v38

    mul-double v36, v36, v38

    sub-double v38, v9, v5

    invoke-static/range {v38 .. v39}, Ljava/lang/Math;->cos(D)D

    move-result-wide v38

    mul-double v36, v36, v38

    sub-double v34, v34, v36

    .line 679
    invoke-static/range {v32 .. v35}, Ljava/lang/Math;->atan2(DD)D

    move-result-wide v11

    .line 683
    .local v11, dBearingRads:D
    const-wide v32, 0x404ca5dc1a63c1f8L

    mul-double v17, v11, v32

    .line 684
    const-wide/16 v32, 0x0

    cmpg-double v32, v17, v32

    if-gez v32, :cond_1

    .line 686
    const-wide v32, 0x4076800000000000L

    add-double v17, v17, v32

    .line 692
    .end local v3           #dLatRadsPrev:D
    .end local v5           #dLngRadsPrev:D
    .end local v7           #dLatRadsCur:D
    .end local v9           #dLngRadsCur:D
    .end local v11           #dBearingRads:D
    .end local v15           #dDistRads:D
    :cond_1
    new-instance v31, Lcom/glympse/platform/common/LocPoint;

    invoke-direct/range {v31 .. v31}, Lcom/glympse/platform/common/LocPoint;-><init>()V

    .line 693
    .local v31, oLocPoint:Lcom/glympse/platform/common/LocPoint;
    const/16 v32, 0x2

    move/from16 v0, v32

    move-object/from16 v1, v31

    iput v0, v1, Lcom/glympse/platform/common/LocPoint;->m_eLocProvider:I

    .line 694
    move-wide/from16 v0, v19

    move-object/from16 v2, v31

    iput-wide v0, v2, Lcom/glympse/platform/common/LocPoint;->m_dLatitude:D

    .line 695
    move-wide/from16 v0, v23

    move-object/from16 v2, v31

    iput-wide v0, v2, Lcom/glympse/platform/common/LocPoint;->m_dLongitude:D

    .line 696
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/glympse/platform/LocManager$ProviderSimulator;->m_oRandom:Ljava/util/Random;

    move-object/from16 v32, v0

    const/16 v33, 0x14

    invoke-virtual/range {v32 .. v33}, Ljava/util/Random;->nextInt(I)I

    move-result v32

    const/16 v33, 0xa

    sub-int v32, v32, v33

    move/from16 v0, v32

    add-int/lit16 v0, v0, 0xc8

    move/from16 v32, v0

    move/from16 v0, v32

    int-to-float v0, v0

    move/from16 v32, v0

    move/from16 v0, v32

    move-object/from16 v1, v31

    iput v0, v1, Lcom/glympse/platform/common/LocPoint;->m_fltAltitudeMeters:F

    .line 697
    move-wide/from16 v0, v17

    double-to-float v0, v0

    move/from16 v32, v0

    move/from16 v0, v32

    move-object/from16 v1, v31

    iput v0, v1, Lcom/glympse/platform/common/LocPoint;->m_fltBearingDegrees:F

    .line 698
    move-wide/from16 v0, v25

    double-to-float v0, v0

    move/from16 v32, v0

    move/from16 v0, v32

    move-object/from16 v1, v31

    iput v0, v1, Lcom/glympse/platform/common/LocPoint;->m_fltSpeedMetersPerSecond:F

    .line 699
    const-wide/high16 v32, 0x4000

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/glympse/platform/LocManager$ProviderSimulator;->m_oRandom:Ljava/util/Random;

    move-object/from16 v34, v0

    invoke-virtual/range {v34 .. v34}, Ljava/util/Random;->nextDouble()D

    move-result-wide v34

    add-double v32, v32, v34

    move-wide/from16 v0, v32

    double-to-float v0, v0

    move/from16 v32, v0

    move/from16 v0, v32

    move-object/from16 v1, v31

    iput v0, v1, Lcom/glympse/platform/common/LocPoint;->m_fltAccuracyMeters:F

    .line 700
    move-wide/from16 v0, v29

    move-object/from16 v2, v31

    iput-wide v0, v2, Lcom/glympse/platform/common/LocPoint;->m_lLocationTime:J

    .line 701
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/glympse/platform/LocManager$ProviderSimulator;->this$0:Lcom/glympse/platform/LocManager;

    move-object/from16 v32, v0

    move-object/from16 v0, v32

    move-object/from16 v1, v31

    invoke-virtual {v0, v1}, Lcom/glympse/platform/LocManager;->AddLocation(Lcom/glympse/platform/common/LocPoint;)V

    .line 703
    move-object/from16 v0, v31

    move-object/from16 v1, p0

    iput-object v0, v1, Lcom/glympse/platform/LocManager$ProviderSimulator;->m_oLocPointLast:Lcom/glympse/platform/common/LocPoint;

    goto/16 :goto_0
.end method
